package LeetCode;

import java.util.ArrayList;
import java.util.List;

public class LC204 {
    public int countPrimes(int n) {
        if(n<=2) return 0;
        if(n==3) return 1;
        int ans =2;
        for (int i = 4; i < n ; i++) {
            if(getPrime(i)) ans++;
        }
        return ans;
    }
    public boolean getPrime(int n ){
        for (int i = 2; i*i <= n; i++) {
            if(n%i==0) return false;
        }
        return true;
    }
}